<?php
include_once('../global.php');
$show = $_GET['show'];
$cls = $_GET['cls'];
$pl_id = $_GET['pl_id'];
$tm_id = $_GET['tm_id'];

$roundtext = array(
	1 => '第一轮',
	2 => '第二轮',
	3 => '决赛轮',
	4 => '',
);

$menus = array(
	1 => t('event_intro'),       // 赛事介绍
	3 => t('event_schedule'),    // 赛事日程
	5 => t('live_score'),        // 成绩直播
	7 => t('theme_activity'),    // 主题活动
	9 => t('photo_live'),        // 照片直播
	11 => t('event_notice')      // 赛事公告
);
$user_id = $_SESSION['user_id'];
if (empty($user_id)) { //登录操作
	$_SESSION['redirect_url'] = $_SERVER['REQUEST_URI'];
	header('Location: /bmwjunior/mobile/login.php');

	// 停止脚本执行
	exit;
}

$type = $_SESSION['type'];
if ($type == 2) { //会员  跳转到试乘试驾页面
	echo "<script>alert('账号输入错误，请重新登录');window.location.href='https://mapp.scoringchina.com/bmwjunior/mobile/login.php';</script>";
	exit;
	//  header('Location: /bmwjunior/mobile/testdrive.php?biaoji=online');
	exit;
}
?>
<!DOCTYPE html
	PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>

<head>
	<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
	<meta name="viewport"
		content="width=device-width, initial-scale=1, minimum-scale=1.0,maximum-scale=1.0,user-scalable=no">
	<script type="text/javascript" src="<?php echo JS_PATH ?>jquery-1.8.3.min.js"></script>
	<script type="text/javascript" src="<?php echo JS_PATH ?>main.js"></script>
	<link href="<?php echo CSS_PATH ?>index.css" rel="stylesheet" type="text/css">
	<link href="<?php echo CSS_PATH ?>stylesheet.css" rel="stylesheet" type="text/css">
	<title><?php echo $match_cn_name ?></title>
	<script src="https://res.wx.qq.com/open/js/jweixin-1.6.0.js "></script>

	<script>
		var url = location.href;
		var wxdata;
		//alert(url.split("&")[0]);
		console.log(url.replace(/\&/g, "%26").replace(/\#/g, "%23"));
		$.ajax({
			type: "get",
			//url : "../interface/joysports/Home/gettoken/?url="+ url.replace(/\&/g,"%26").replace(/\#/g,"%23"), location.href.split('#')[0]
			url: "../../interface/Bmwtnc/Home/gettoken/?url=" + encodeURIComponent(location.href.split('#')[0]),
			dataType: "jsonp",
			jsonp: "callback",
			jsonpCallback: "success_jsonpCallback",
			success: function (data) {
				console.log(data);
				wxdata = data;
				wx.config({
					debug: false,
					appId: data.appId,
					timestamp: data.timestamp,
					nonceStr: data.nonceStr,
					signature: data.signature,
					jsApiList: [
						'updateAppMessageShareData',
						'updateTimelineShareData'
					]
				});
				wx.ready(function () {
					var shareData = {
						title: '<?php echo $match_cn_name ?>-赛事主页',
						desc: '<?php echo $course_name ?>',
						link: url,
						imgUrl: 'https://mapp.scoringchina.com/bmwjunior/mobile/images/logo.png'
					};
					//alert(wxdata.url);
					//alert(url);
					wx.updateAppMessageShareData(shareData); //
					wx.updateTimelineShareData(shareData); //
					wx.onMenuShareQQ(shareData); //
					wx.onMenuShareWeibo(shareData); //
					wx.onMenuShareQZone(shareData); //



				});
				wx.error(function (res) {
					console.log(res);
					alert(res.errMsg); //

				});
			},
			error: function (data) {
				console.log(data);
				alert("微信认证失败");
			}
		});






		var mt_id = <?php echo $mt_id; ?>;
		var rd_id = <?php echo $rd_id; ?>;
		var mt_sts = '<?php echo $mt_sts; ?>';
		var mt_round = <?php echo $mt_round; ?>;

		var pl_id = '<?php echo $pl_id; ?>';
		var tm_id = '<?php echo $tm_id; ?>';
		var cls = '<?php echo $cls; ?>';

		var time = 60 * 5; //鑷姩鍒锋柊浜斿垎閽?


		function changeround(rd) {
			if (rd <= mt_round) {
				rd_id = rd;
				//getdata(rd_id);

				window.location = './index.php?mt_id=' + mt_id + '&rd_id=' + rd_id;
			}
		}

		function gocls(tmpcls) {
			cls = tmpcls;
			window.location = './index.php?mt_id=' + mt_id + '&cls=' + cls;
		}


		function gotoad(cls) {
			if (cls == 1) {
				//window.location = './localrules.php?mt_id='+mt_id + '&cls='+cls;
			}

		}



		function gotomenu(cls) {
			if (cls == 0) {

				window.open('https://dlp-landing-stg.bmw.com.cn/h5/hcbm/odyssey/editor/pages/static-html/5F3s8YzsHu', '_blank');
				//window.location = './registe.php?mt_id='+mt_id + '&cls='+cls;
			}
			if (cls == 1) {

				window.location = './eventintroduce.php?mt_id=' + mt_id + '&cls=' + cls;
			}
			if (cls == 2) {

				window.location = './regarlution.php?mt_id=' + mt_id + '&cls=' + cls;
			}
			if (cls == 3) {

				window.location = './schedule.php?mt_id=' + mt_id + '&cls=' + cls;
			}
			if (cls == 4) {
				window.location = './group.php?mt_id=' + mt_id + '&rd_id=' + rd_id;
			}
			if (cls == 5) {
				window.location = './index.php?mt_id=' + mt_id + '&rd_id=' + rd_id;
			}

			if (cls == 6) {

				window.location = './courseintro.php?mt_id=' + mt_id + '&rd_id=' + rd_id;
			}
	

			if (cls == 9) {
    <?php if ($lang === 'CN') { ?>
        //window.open('https://live.photoplus.cn/live/pc/93687507/#/live');
	window.open('https://live.photoplus.cn/live/95576984?accessFrom=qrcode#/live');


    <?php } else { ?>
        window.open('https://live.photoplus.cn/live/pc/26736420/#/live');
    <?php } ?>
    return;
}

			if (cls == 7) {
				window.location = './matchevent.php?mt_id=' + mt_id + '&cls=' + cls;
			}
			if (cls == 8) {

				window.location = './testdrive.php?mt_id=' + mt_id + '&rd_id=' + rd_id;
			}

			if (cls == 10) {

				window.location = './my.php?mt_id=' + mt_id + '&rd_id=' + rd_id;
			}
			if (cls == 11) {

				window.location = './noticelist.php?mt_id=' + mt_id + '&rd_id=' + rd_id;
			}
		}




		$(function () {
			$("#go_top").hide();
		})

		//scroll() 
		$(window).scroll(function () {
			if ($(window).scrollTop() > 100) {
				//  $("#go_top").fadeIn(800);
			} else {
				//$("#go_top").fadeOut(800);
			}
			pl_id = '';

		});




		$("#go_top").click(function () {
			$('body,html').animate({
				scrollTop: 0
			}, 100);
			return false;
		});

		function gotottop() {
			$('body,html').animate({
				scrollTop: 0
			}, 100);
			return false;
		}

		function initlocation() {
			if (pl_id) {
				scrollPosition('p_' + pl_id);
			}
			if (tm_id) {
				scrollPosition('t_' + tm_id);
			}
		}

		function scrollPosition(pElementId) {
			var tTop = jQuery("#" + pElementId).offset().top; //
			var tWindowHeight = jQuery(window).height(); //
			var tElementHeight = jQuery("#" + pElementId).height(); //
			var tScrollTop = tTop - 126; //
			jQuery('html, body').animate({
				scrollTop: tScrollTop
			}, 1000);
		}
	</script>
	<style>
		.banner {
			width: 100%;
			height: auto;
			background-color: transparent;
		}

		#sta {
			position: fixed;
			z-index: 99;
			height: 80px;
			width: 100%;
			background-color: transparent;
			left: 0;
			top: 0;
		}

		#content_score {
			min-height: 20px;
			padding: 80px 0 0px;
			overflow: scroll;
			max-height: 100vh;
		}

		.radius_fillet3 {
			border-radius: 3px;
		}

		.tt_bar {
			height: 30px;
			border-bottom: 1px solid #e3e3e3;
		}

		.score_title2 {
			height: 30px;
			border-bottom: 1px solid #e3e3e3;
			text-indent: 14px;
		}

		.score_back {
			text-align: right;
			padding-right: 14px;
		}

		.bt_back {
			display: inline-block;
			width: 40px;
			height: 18px;
			line-height: 18px;
			cursor: pointer;
			border: 1px solid #363636;
			color: #363636;
			font-size: 12px;
			text-align: center;
		}

		.score_tround {
			height: 30px;
			line-height: 30px;
		}

		.score_tround span {
			color: #363636;
			float: right;
			font-size: 18px;
			height: 26px;
			line-height: 32px;
			margin-right: 15px;
			text-align: center;
			width: 50px;
		}

		.index_news {
			padding: 0 0px;
		}

		#playoff {
			margin: 15px;
			border: solid 1px #a9c6c9;
		}

		.country {
			color: #ef7ca3;
		}

		.playofftitle {
			background-color: white;
			color: #666;
			font-weight: bold;
			height: 30px;
			font-size: 15px;
		}

		.playoffhole {
			background-color: #F0F0F0;
			height: 30px;
			color: #666;
			font-weight: bold;

		}

		.playoffplayer {
			border-bottom: solid 1px #FFF;
			height: 30px;
		}

		#loadingimg {
			width: 40px;
			height: 40px;
			position: absolute;
			left: 50%;
			top: 50%;
			transform: translate(-50%, -50%);
			z-index: 999;
		}
	</style>
	<!--header-->
	<style>
		#body {
			font-family: 'pangmen';
			max-width: 1280px;
			margin-left: auto;
			margin-right: auto;

		}

		.up {
			width: 40px;
			height: 40px;
			position: fixed;
			left: 2vw;
			bottom: 5vw;
		}

		#navi_wait {
			height: 35px;
			background-color: #E3E3E3;
		}

		#navi_wait ul li {
			width: 32%;
			display: inline;
			float: left;
			/*line-height:33px;*/

			line-height: 36px;
			list-style-position: inside;
			border-bottom: 1px solid #A5A5A5;
			text-align: center;
		}

		#navi_wait ul li a {
			color: #767676;
			font-size: 19px;
			letter-spacing: 5px;
		}


		.scoringtable {
			border-top-left-radius: 5px;
			border-top-right-radius: 5px;
			border-bottom-right-radius: 5px;
			border-bottom-left-radius: 5px;
			border-collapse: collapse;
			border-style: hidden;
			box-shadow: 0 0 0 1px #d8d8d8;
			overflow: hidden;
		}

		.topar {
			width: 90%;
			height: 28px;
			border-radius: 10px;
			margin: auto auto auto auto;
			color: #fff;
			display: flex;
			justify-content: center;
			align-items: center;

		}

		.undereven {
			font-weight: bolder;
			background-color: #B7001F;
			color: #fff;
		}

		.even {
			font-weight: bolder;
			background-color: #53565A;
			color: #fff;
		}

		.pluseven {
			font-weight: bolder;
			background-color: #00438A;
			color: #fff;
		}


		.groupcode {
			display: flex;
			flex-dircetion: row;
			float: left;
			align-items: center;
			margin-top: 10px;
			margin-bottom: 5px;
			width: 100%;
		}

		.groupcode div {
			width: 120px;
			height: 30px;
			display: flex;
			justify-content: center;
			align-items: center;
			color: #000;
			border-radius: 10px;
			margin-left: 10px;
		}

		.full {
			width: 100vw;
			height: 100vh;
			position: absolute;
			left: 0;
			top: 0;
			z-index: 99999;
			overflow: hidden;
		}

		.full img {
			width: 100%;
			height: 100%;
			position: absolute;
			object-fit: cover;
		}

		.full .welcome {
			width: 90%;
			position: absolute;
			left: 60px;
			top: 150px;
			z-index: 100000;
			font-size: 40px;
			text-align: left;
		}

		.small {
			width: 60%;
			height: 4px;
			margin-left: auto;
			margin-right: auto;
			border-radius: 4px;
		}

		.menu {
			width: 60px;
			float: right;
			margin-left: 1px;
			height: 100%;
			color: #fff;
			margin-right: 2px;
			display: flex;
			justify-content: center;
			align-items: center;
		}

		.menulist {
			width: 98%;
			margin-left: auto;
			margin-right: auto;
			height: 62vh;
			display: flex;
			justify-content: center;
			align-items: flex-start;
			flex-wrap: wrap;
			margin-top: 0px;
		}

		.menuicon {
			width: 33vw;
			height: 33vw;
			max-height: 22vh;
			margin-left: auto;
			margin-right: auto;
			margin-top: auto;
			margin-bottom: auto;
			display: flex;
			flex-direction: column;
			justify-content: center;
			align-items: center;
			background-color: transparent;
			border-radius: 0.625rem;
			position: relative;
			overflow: hidden;
		}

		.iconreg {
			width: 100%;
			border-radius: 0.625rem;
			height: auto;
			margin-bottom: 20px;
		}

		.iconlist {
			width: 100%;
			display: flex;
			flex-direction: row;
			justify-content: flex-bettwen;
			align-items: center;
			height: auto;
			margin-bottom: 20px;
			margin-top: 0px;
		}

		.iconlistitem {
			width: 45%;
			height: 50px;
			object-fit: cover;
			overflow: hidden;
			border-radius: 0.625rem;
			margin-left: auto;
			margin-right: auto;
			display: flex;
			justify-content: center;
			align-items: center;
			background: linear-gradient(180deg, #196f64, #041a32);
		}



		.menuicon img {
			width: 100%;
			height: 100%;
			position: absolute;
			z-index: 1;
			border-radius: 10px;
			left: 0;
			top: 0;
			object-fit: cover;
			overflow: hidden;
			box-shadow: 15px 15px 15px rgba(0, 0, 0, 0.5);
		}

		.menuicon text {
			width: 100%;
			position: absolute;
			z-index: 2;
			left: 50%;
			bottom: 0px;
			transform: translateX(-50%);
			text-align: center;
			font-size: 1rem;
			font-weight: 300;
			color: #fff;
			/* height: 1.4rem; */
			display: flex;
			align-items: center;
			justify-content: center;
			background: rgba(0, 0, 0, 0.5);
			line-height: 1.5;
			height: auto;
		}


		.adlist {
			width: 98%;
			margin-left: auto;
			margin-right: auto;
			height: auto;
			display: flex;
			margin-top: 5px;
			justify-content: center;
			align-items: center;
			flex-wrap: wrap;
		}

		.adlisticon {
			width: 100%;
			border-radius: 10px;
			overflow: hidden;
			box-shadow: 1px 5px 5px #f1f1f1;
			margin-bottom: 10px;
		}

		.adlist img {
			width: 100%;
			height: auto;

		}

		.bottommenu .myimgdiv {
			position: fixed;
			bottom: 0px;
			width: 100px;
			height: 100px;
			border-top-left-radius: 50px;
			border-top-right-radius: 50px;
			z-index: -1;
			/*background-color: rgba(60, 159, 242);*/
			background-color: rgba(0, 60, 71, 0.8);
		}

		.bottommenu {
			/*background-color: rgba(60, 159, 242);*/
			background-color: rgba(0, 60, 71);

		}

		.myimg {
			position: fixed;
			bottom: 10px;
			width: 80px;
			height: 80px;
			border-radius: 100%;
			z-index: 1111;
		}



		.sponsorcontainer {
			width: 98%;
			margin-left: auto;
			margin-right: auto;
			height: auto;
			display: flex;
			justify-content: center;
			align-items: center;
			flex-wrap: wrap;
			margin-top: 0.2vw;
		}

		.sponsor {
			width: 4.5rem;
			height: 3rem;
			margin-left: auto;
			margin-right: auto;
			border-radius: 1vw;
		}
	</style>
</head>

<body id="body">
	<div id="fullloading" class="full" style="display:none;" onclick="closefullpre();return false;">
		<img id="imgfullloading" src="./images/pre.jpg" />

	</div>
	<div id="sta">
		<table width="100%" border="0" cellpadding="0" cellspacing="0">
			<tbody>
				<tr>
					<td style="text-align:center;"><img src="./images/000.png" style="width:350px;height:80px" /></td>
					<!-- 右上角语言切换按钮 -->
					<div style="position: fixed; top: 30px; right: 10px; z-index: 1000;">
						<form method="get" style="margin: 0;">
							<button type="submit" name="lang" value="<?php echo $lang === 'CN' ? 'en' : 'CN'; ?>"
								style="background-color: transparent; color: #fff; border: none; padding: 5px 10px; border-radius: 5px; cursor: pointer; font-size:20px">
								<?php echo $lang === 'CN' ? 'EN' : 'CN'; ?>
							</button>
						</form>
					</div>
				</tr>
			</tbody>
		</table>
	</div>


	<img id="loadingimg" src="./images/icon_load.gif" style="display:none;" />
	<div id="content_score" style="">

		<div class="pullrefresh" style="display:none;"></div>


		<marquee style="margin-top:10px;display:none;" width="100%" align="absmiddle" height="30">
			<font style="color:#B7001F;"><b></b>,</font>
		</marquee>
		<div id="content_1" class="index_news">
			<table class="altrowstable scoringtable" style="display:none;">
				<tr>

					<td style="border:none; vertical-align:middle;">
						<div>
							<font style="font-weight:bolder;font-size:17px;"><?php echo $match_cn_name; //'-鎸戞垬璧?' ;// 
							?></font>
						</div>

					</td>



				</tr>
				<tr>

					<td style="border:none; vertical-align:middle;">
						<div>
							<font style="font-weight:bolder;font-size:16px;"><?php echo $course_name; //'-鎸戞垬璧?' ;// 
							?></font>
						</div>

					</td>


				</tr>
				<tr>

					<td style="border:none; vertical-align:middle;">
						<div>
							<font style="font-weight:bold;font-size:15px;color:#18a8da"><?php echo $mt_start_date; //'-鎸戞垬璧?' ;// 
							?>
							</font>
						</div>

					</td>

				</tr>
			</table>



			<div id="scoringlists" class="menulist">
				<img style="display:none;" src="./images/icon0.png" class="iconreg" onclick="gotomenu(0)"></img>

				<?php
				$index = 1;
				foreach ($menus as $i => $m) {

					?>
					<div class="menuicon" onclick="gotomenu(<?php echo $i; ?>)">
						<img src="./images/icon-00<?php echo $index; ?>.png?v=11"></img>
						<text class="<?php echo $css_class; ?>"><?php echo $m; ?></text>
					</div>

					<?php $index++;
				} ?>
				<div class="iconlist" style="display:none;">

					<div class="iconlistitem" onclick="gotomenu(11)">赛事公告</div>
					<div class="iconlistitem" onclick="gotomenu(10)">我 的</div>
				</div>
			</div>

			<text style="color:#18a8da;font-size:20px;font-weight:800;display:none;"></text>
			<div id="adlist" class="adlist">

				<?php for ($index = 1; $index <= 0; $index++) { ?>
					<div class="adlisticon" onclick="gotoad(<?php echo $index; ?>)">
						<img src="./images/<?php echo $index; ?>.gif"></img>
					</div>

				<?php } ?>

			</div>
		</div>





	</div>

	<div class="sponsorcontainer">
		<img class="sponsor" src="./images/s-005.png"></img>
		<img class="sponsor" src="./images/s-000.png"></img>

	  <img class="sponsor" src="./images/s-006.png"></img>
	</div>
	<div class="sponsorcontainer" style="margin-top: -10px;">
    <img class="sponsor" src="./images/s-001.png"></img>
		<img class="sponsor" src="./images/s-002.png"></img>
		<img class="sponsor" src="./images/s-004.png"></img>
		<img class="sponsor" src="./images/s-003.png"></img>
	</div>




	<div class="bottommenu">
		<div class="myimgdiv"></div> <img class="myimg" src="./images/icon-010.png" onclick="gotomenu(10)"></img>
	</div>
	<div id="bottom" style="background-color:transparent;text-align:centre;display:none;justify-content: center;">
		<div id="bootom-top">
			<span style="width:100%;text-align:center">技术支持 @斯科云科技</span>
			<script charset="UTF-8" id="LA_COLLECT" src="//sdk.51.la/js-sdk-pro.min.js"></script>
			<script>
				LA.init({
					id: "JijETG4HGxctAarj",
					ck: "JijETG4HGxctAarj"
				})
			</script>
		</div>
	</div>
</body>
<script>
	proloading();

	$(document).ready(function () {
		let currentIndex = 0;
		const items = $('#carousel .slide');
		const itemCount = items.length;
		const setSlide = (index) => {
			const translateX = `-${index * 100}%`;
			$('#carousel .slidecontainer').css('transform', `translateX(${translateX})`);
		};



		// 自动轮播
		setInterval(() => {
			currentIndex = (currentIndex + 1) % itemCount;
			setSlide(currentIndex);
		}, 4000); // 轮播间隔时间
	});



	var pretime = "";

	function proloading() {

		let storage = new Storage();
		let value = storage.getItem('isReload');
		if (!value || value == 0) {
			console.log("首次加载");
			$('#fullloading').show();
			storage.setItem({
				name: "isReload",
				value: "1",
				expires: 24 * 3600 * 1000, //
				startTime: new Date().getTime() //
			})
			pretime = setTimeout(function () {
				$('#fullloading').fadeOut(1000);

			}, 3000);
			//$(this).fadeOut("fullloading");
			console.log($('#fullloading'));

		} else {
			console.log("第二次打开");

			//sessionStorage.setItem("isReload", true);
			let storage = new Storage();
			storage.setItem({
				name: "isReload",
				value: "1",
				expires: 24 * 3600 * 1000, //
				startTime: new Date().getTime() //
			})
			$('#fullloading').hide();

			/*pretime = setTimeout(function(){
				$('#fullloading').fadeOut(1000);
			
			},3000);*/
		}

	}


	function closefullpre() {
		console.log($('#fullloading'));
		$('#fullloading').fadeOut(1000);

		clearTimeout(pretime);
	}
</script>

</html>